package cc.taofoo.CCSP.Jud;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Jud {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n,k,t,xa,ya,xb,yb;
        int pass = 0,stay = 0;
        n=scanner.nextInt();
        k=scanner.nextInt();
        t=scanner.nextInt();
        xa=scanner.nextInt();
        ya=scanner.nextInt();
        xb=scanner.nextInt();
        yb=scanner.nextInt();
        Rect rect = new Rect(xa,ya,xb,yb);
        for(int i =0 ;i<n;i++){
            List<Integer> list = new ArrayList<>();
            int cnt = 0,pt = 1,st =1;
            for(int j = 0;j<t;j++){
                int x = scanner.nextInt();
                int y = scanner.nextInt();
                if(rect.isIn(x,y)){
                    cnt ++;
                    pass += pt;
                    pt = 0;
                    if(cnt >= k){
                        stay+=st;
                        st = 0;
                    }
                }else {
                    cnt = 0;
                }
            }
        }
        System.out.println(pass);
        System.out.println(stay);

    }

    static class Rect{
        int xa,ya,xb,yb;
        public Rect(int xa,int ya,int xb,int yb){
            this.xa  = xa;
            this.ya = ya;
            this.xb  = xb;
            this.yb = yb;
        }
        public boolean isIn(int x,int y){
            return (x>=xa)&&(x<=xb)&&(y>=ya)&&(y<=yb);
        }
    }

}
